import { type AxiosRequestConfig } from "axios";

export interface CustomSuccessData<T> {
  code: number;
  msg: string;
  data: T;
  [keys: string]: unknown;
}

export interface Request {
  <T>(
    url: string,
    params?: Record<string, unknown> | FormData,
    config?: AxiosRequestConfig
  ): Promise<CustomSuccessData<T>>;
}
export interface GetStudentCourseParam {
  stuId: string;
}
export interface GetTeacherCourseParam {
  teachId: string;
}
export interface CourseItem {
  courseId: string;
  courseName: string;
  coursePhoto:  string;
  courseSchool: string;
  teacherName: string;
  courseDescription: string;
}
export interface KnowledgeItem {
  id: number;
  name: string;
  isMain: string;
  isBuild: string;
  isBranch: string;
  hasPreNode: string;
}
export interface AddEquipmentParam {
  equipmentName: string;
  equipmentDes: string;
}

export interface DeleteEquipmentParam {
  equipmentUUID: string;
}

export interface ListParam {
  name: string;
  index: number;
  pageSize: number;
}

export interface ListResponse<T> {
  records: Array<T>;
  total: number;
}

export interface Equipment {
  id: string;
  equipmentName: string;
  equipmentUuid: string;
  equipmentDes: string;
  connected: boolean;
  createTime: string;
  updateTime: string;
}

export interface LoginStudentParam {
  stuId: string;
  stuPwd: string;
}

export interface LoginTeacherParam {
  teaId: string;
  teaPwd: string;
}

export interface LoginStudentResult {
  stuId: string;
  token: string;
}
export interface LoginTeacherResult {
  teaId: string;
  token: string;
}

export interface UserInfo {
  username: string;
}

export interface HrrInfo {
  success: number;
  heartbeat: number;
  respiratory: number;
  heartbeatArray: number[];
  respiratoryArray: number[];
}

export interface EquipmentDetailInfo {
  equipmentName: String;
  equipmentUUID: String;
  ip: String | null;
  connectedAt: String | null;
  keepALive: String | null;
  connected: Boolean;
}

export interface QueryEquipmentHistory {
  startDate: Date;
  endDate: Date;
  equipmentUUID: String | undefined;
}

export interface HRR {
  heatbeat: number;
  breath: number;
  createTime: String;
}

export interface EquipmentHistory {
  equipmentUUID: String;
  equipmentName: String;
  hrrList: Array<HRR>;
  heatbeatList: Array<number>;
  breathList: Array<number>;
}

export interface DataParam {
  startDate: Date;
  endDate: Date;
}

export interface Dashboard {
  messageLineChart: LineChartResponseTemplate<number>;
  logLineChart: LineChartResponseTemplate<number>;
  hrrClassifyCount: PieChartData[];
  equipmentCount: number;
  messageCount: number;
  connections: number;
}

export interface LineChartResponseTemplate<T> {
  countList: T[];
  timeList: string[];
}

export interface HrrClassifyCount {
  heatBeatNormalCount: number;
  heatBeatDisNormalCount: number;
  breathNormalCount: number;
  breathDisNormalCount: number;
}

export interface PieChartData {
  name: string;
  value: number;
}
